package com.riskblockchain.exception;


import com.riskblockchain.util.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice  //aop
public class GlobalExceptionHandler {


    //自定义异常处理BlockChainException
    @ExceptionHandler(BlockChainException.class)
    @ResponseBody
    public Result error(BlockChainException e) {
        e.printStackTrace();
        return Result.fail(null).code(e.getCode()).message(e.getMsg());
    }

}
